package kr.hkit.powerjava.chapter21.work;

import java.util.Scanner;

public class Lab2 {
	public static void main(String[] args) {
		int[] list;
		int sum =0, count = 0;
		
		Scanner sc = new Scanner(System.in);
		try{
		System.out.println("정수의 개수: ");
		count = sc.nextInt();
		list = new int[count];
		for(int i=0; i<count; i++){
			System.out.println("정수를 입력하시오.");
			list[i] = sc.nextInt();
		}
		for(int i=0; i<count; i++){
			sum+= list[i];
		}
		}catch(ArithmeticException e){
			System.out.println("ArithmeticException");
			
		}catch(NegativeArraySizeException e){
			System.out.println("NegativeArraySizeException");
			
		}catch(ArrayIndexOutOfBoundsException e){
			System.out.println("ArrayIndexOutOfBoundsException");
						
		}catch(NullPointerException e){
			System.out.println("NullPointerException");
			
		}
		System.out.println("평균은 : "+sum/count);
	}
}
